```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java字符串处理：String、StringBuffer与StringBuilder对比</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .feature-icon {
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
            margin-bottom: 1.5rem;
        }
        .comparison-table {
            border-collapse: separate;
            border-spacing: 0;
        }
        .comparison-table th, .comparison-table td {
            padding: 1rem;
            text-align: left;
            border-bottom: 1px solid #e2e8f0;
        }
        .comparison-table th {
            background-color: #f8fafc;
            font-weight: 600;
        }
        .comparison-table tr:hover td {
            background-color: #f8fafc;
        }
        .mermaid-container {
            background: white;
            border-radius: 0.5rem;
            padding: 1.5rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 sm:px-6 lg:px-8">
        <div class="max-w-4xl mx-auto text-center">
            <h1 class="text-4xl md:text-5xl font-bold mb-6">Java字符串处理三剑客</h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90">深入解析String、StringBuffer与StringBuilder的核心差异与应用场景</p>
            <div class="flex justify-center space-x-4">
                <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full text-sm font-medium">#Java基础</span>
                <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full text-sm font-medium">#性能优化</span>
                <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full text-sm font-medium">#多线程</span>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <!-- Introduction -->
        <div class="prose prose-lg max-w-none mb-16">
            <p class="text-gray-700 text-lg leading-relaxed">
                在Java开发中，字符串处理是最常见的操作之一。<code>String</code>、<code>StringBuffer</code>和<code>StringBuilder</code>是Java提供的三种字符串处理类，它们各有特点，适用于不同的场景。本文将全面解析这三者的核心差异，并通过可视化方式帮助您理解它们的内存机制和性能特点。
            </p>
        </div>

        <!-- Key Features Cards -->
        <div class="grid md:grid-cols-3 gap-8 mb-16">
            <!-- String Card -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-6">
                    <div class="feature-icon bg-blue-100 text-blue-600">
                        <i class="fas fa-lock text-2xl"></i>
                    </div>
                    <h3 class="text-2xl font-bold mb-3">String</h3>
                    <p class="text-gray-600 mb-4">
                        不可变字符串对象，每次修改都会创建新对象，适合少量字符串操作和常量字符串使用。
                    </p>
                    <ul class="text-gray-600 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>线程安全（因为不可变）</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>字符串常量池优化</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-exclamation-circle text-yellow-500 mt-1 mr-2"></i>
                            <span>频繁修改性能较低</span>
                        </li>
                    </ul>
                </div>
            </div>

            <!-- StringBuffer Card -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-6">
                    <div class="feature-icon bg-purple-100 text-purple-600">
                        <i class="fas fa-users text-2xl"></i>
                    </div>
                    <h3 class="text-2xl font-bold mb-3">StringBuffer</h3>
                    <p class="text-gray-600 mb-4">
                        可变字符串序列，线程安全，适合多线程环境下的字符串操作。
                    </p>
                    <ul class="text-gray-600 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>线程安全（synchronized）</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>直接修改原对象，不创建新实例</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-exclamation-circle text-yellow-500 mt-1 mr-2"></i>
                            <span>单线程下性能略低</span>
                        </li>
                    </ul>
                </div>
            </div>

            <!-- StringBuilder Card -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-6">
                    <div class="feature-icon bg-green-100 text-green-600">
                        <i class="fas fa-bolt text-2xl"></i>
                    </div>
                    <h3 class="text-2xl font-bold mb-3">StringBuilder</h3>
                    <p class="text-gray-600 mb-4">
                        StringBuffer的非线程安全版本，性能最高，适合单线程环境下的字符串操作。
                    </p>
                    <ul class="text-gray-600 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>性能最优（无同步开销）</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>直接修改原对象，不创建新实例</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-exclamation-circle text-yellow-500 mt-1 mr-2"></i>
                            <span>多线程环境下不安全</span>
                        </li>
                    </ul>
                </div>
            </div>
        </div>

        <!-- String Section -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <div class="flex-shrink-0 mr-4">
                    <div class="flex items-center justify-center h-12 w-12 rounded-md bg-blue-500 text-white">
                        <span class="text-lg font-bold">1</span>
                    </div>
                </div>
                <h2 class="text-3xl font-bold text-gray-900">String - 不可变字符串</h2>
            </div>

            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                <div class="p-6">
                    <h3 class="text-xl font-semibold mb-4 text-blue-600">核心特性</h3>
                    <p class="text-gray-700 mb-4">
                        <code>String</code>是Java中最基本的字符串表示形式，它的核心特点是<strong>不可变性</strong>。这意味着一旦一个<code>String</code>对象被创建，它的值就不能被改变。任何看似修改字符串的操作，实际上都会创建一个新的<code>String</code>对象。
                    </p>
                    <div class="mermaid-container">
                        <div class="mermaid">
                            classDiagram
                                class String {
                                    -final char[] value
                                    +String(String original)
                                    +charAt(int index)
                                    +concat(String str)
                                    +replace(char oldChar, char newChar)
                                    +substring(int beginIndex)
                                }
                                note for String "不可变性：\n每次修改操作都会\n创建新String对象"
                        </div>
                    </div>
                </div>
            </div>

            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <h3 class="text-xl font-semibold mb-4 text-blue-600">内存机制</h3>
                        <p class="text-gray-700 mb-4">
                            Java有一个特殊的存储区域叫做"字符串常量池"。当创建一个字符串字面量时，JVM会首先检查常量池中是否已经存在相同内容的字符串。如果存在，则直接返回引用；如果不存在，则在常量池中创建新字符串。
                        </p>
                        <div class="border-l-4 border-blue-400 pl-4 italic text-gray-600">
                            <p>例如：</p>
                            <p><code>String s1 = "Hello";</code> // 在常量池创建</p>
                            <p><code>String s2 = "Hello";</code> // 复用常量池中的"Hello"</p>
                            <p><code>s1 == s2</code> // true，引用相同</p>
                        </div>
                    </div>
                </div>
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <h3 class="text-xl font-semibold mb-4 text-blue-600">适用场景</h3>
                        <ul class="text-gray-700 space-y-3">
                            <li class="flex items-start">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                </div>
                                <div>
                                    <strong>字符串常量</strong>：程序中的固定文本，如配置信息、提示消息等
                                </div>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                </div>
                                <div>
                                    <strong>哈希表键值</strong>：由于不可变性，非常适合作为HashMap的键
                                </div>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                </div>
                                <div>
                                    <strong>少量字符串操作</strong>：不需要频繁修改字符串的场景
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </section>

        <!-- StringBuffer Section -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <div class="flex-shrink-0 mr-4">
                    <div class="flex items-center justify-center h-12 w-12 rounded-md bg-purple-500 text-white">
                        <span class="text-lg font-bold">2</span>
                    </div>
                </div>
                <h2 class="text-3xl font-bold text-gray-900">StringBuffer - 线程安全的可变字符串</h2>
            </div>

            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                <div class="p-6">
                    <h3 class="text-xl font-semibold mb-4 text-purple-600">核心特性</h3>
                    <p class="text-gray-700 mb-4">
                        <code>StringBuffer</code>是Java提供的可变字符串类，它与<code>String</code>最大的区别在于其内容可以被修改而不需要创建新对象。<code>StringBuffer</code>的所有公共方法都是同步的(<code>synchronized</code>)，因此它是线程安全的。
                    </p>
                    <div class="mermaid-container">
                        <div class="mermaid">
                            classDiagram
                                class StringBuffer {
                                    -char[] value
                                    -int count
                                    +append(String str)
                                    +insert(int offset, String str)
                                    +delete(int start, int end)
                                    +reverse()
                                }
                                note for StringBuffer "线程安全：\n所有公共方法都是\nsynchronized的"
                        </div>
                    </div>
                </div>
            </div>

            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <h3 class="text-xl font-semibold mb-4 text-purple-600">内部实现</h3>
                        <p class="text-gray-700 mb-4">
                            <code>StringBuffer</code>内部维护一个字符数组(<code>char[]</code>)来存储字符串内容。当容量不足时，它会自动扩容（通常是原容量的2倍+2）。这种设计避免了频繁创建新对象，提高了性能。
                        </p>
                        <div class="border-l-4 border-purple-400 pl-4 italic text-gray-600">
                            <p>扩容示例：</p>
                            <p>默认容量：16字符</p>
                            <p>添加17个字符时：</p>
                            <p>新容量 = (16 * 2) + 2 = 34</p>
                        </div>
                    </div>
                </div>
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <h3 class="text-xl font-semibold mb-4 text-purple-600">适用场景</h3>
                        <ul class="text-gray-700 space-y-3">
                            <li class="flex items-start">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-users text-purple-500 mt-1 mr-2"></i>
                                </div>
                                <div>
                                    <strong>多线程环境</strong>：需要多个线程同时操作同一个字符串缓冲区时
                                </div>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-sync-alt text-purple-500 mt-1 mr-2"></i>
                                </div>
                                <div>
                                    <strong>频繁字符串修改</strong>：需要大量字符串拼接、插入、删除等操作
                                </div>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-random text-purple-500 mt-1 mr-2"></i>
                                </div>
                                <div>
                                    <strong>动态构建字符串</strong>：如循环中逐步构建字符串内容
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </section>

        <!-- StringBuilder Section -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <div class="flex-shrink-0 mr-4">
                    <div class="flex items-center justify-center h-12 w-12 rounded-md bg-green-500 text-white">
                        <span class="text-lg font-bold">3</span>
                    </div>
                </div>
                <h2 class="text-3xl font-bold text-gray-900">StringBuilder - 高性能可变字符串</h2>
            </div>

            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                <div class="p-6">
                    <h3 class="text-xl font-semibold mb-4 text-green-600">核心特性</h3>
                    <p class="text-gray-700 mb-4">
                        <code>StringBuilder</code>是JDK 1.5引入的类，它与<code>StringBuffer</code>几乎完全一致，唯一的区别是它的方法<strong>没有同步</strong>，因此它在单线程环境下性能更高。在不需要考虑线程安全的情况下，<code>StringBuilder</code>是首选。
                    </p>
                    <div class="mermaid-container">
                        <div class="mermaid">
                            classDiagram
                                class StringBuilder {
                                    -char[] value
                                    -int count
                                    +append(String str)
                                    +insert(int offset, String str)
                                    +delete(int start, int end)
                                    +reverse()
                                }
                                note for StringBuilder "非线程安全：\n性能优于StringBuffer\n(无同步开销)"
                        </div>
                    </div>
                </div>
            </div>

            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <h3 class="text-xl font-semibold mb-4 text-green-600">性能优势</h3>
                        <p class="text-gray-700 mb-4">
                            由于去掉了同步锁的开销，<code>StringBuilder</code>在单线程环境下的性能明显优于<code>StringBuffer</code>。测试表明，在大量字符串拼接操作中，<code>StringBuilder</code>的速度可以比<code>StringBuffer</code>快10%-15%。
                        </p>
                        <div class="border-l-4 border-green-400 pl-4 italic text-gray-600">
                            <p>性能测试示例：</p>
                            <p>100,000次字符串拼接：</p>
                            <p>StringBuilder: ~15ms</p>
                            <p>StringBuffer: ~20ms</p>
                            <p>String: ~4500ms</p>
                        </div>
                    </div>
                </div>
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <h3 class="text-xl font-semibold mb-4 text-green-600">适用场景</h3>
                        <ul class="text-gray-700 space-y-3">
                            <li class="flex items-start">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-tachometer-alt text-green-500 mt-1 mr-2"></i>
                                </div>
                                <div>
                                    <strong>高性能需求</strong>：需要频繁修改字符串且对性能要求高的场景
                                </div>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-user text-green-500 mt-1 mr-2"></i>
                                </div>
                                <div>
                                    <strong>单线程环境</strong>：确定字符串操作只在一个线程中执行时
                                </div>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-code text-green-500 mt-1 mr-2"></i>
                                </div>
                                <div>
                                    <strong>方法局部变量</strong>：作为方法内的局部变量使用时（通常是线程安全的）
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </section>

        <!-- Comparison Section -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <div class="flex-shrink-0 mr-4">
                    <div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
                        <i class="fas fa-balance-scale text-lg"></i>
                    </div>
                </div>
                <h2 class="text-3xl font-bold text-gray-900">三者对比与选择建议</h2>
            </div>

            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                <div class="p-6">
                    <div class="overflow-x-auto">
                        <table class="min-w-full comparison-table">
                            <thead>
                                <tr>
                                    <th class="text-left">特性</th>
                                    <th class="text-left">String</th>
                                    <th class="text-left">StringBuffer</th>
                                    <th class="text-left">StringBuilder</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td class="font-medium">可变性</td>
                                    <td>不可变</td>
                                    <td>可变</td>
                                    <td>可变</td>
                                </tr>
                                <tr>
                                    <td class="font-medium">线程安全性</td>
                                    <td>线程安全(不可变)</td>
                                    <td>线程安全(synchronized)</td>
                                    <td>非线程安全</td>
                                </tr>
                                <tr>
                                    <td class="font-medium">性能</td>
                                    <td>低(频繁创建对象)</td>
                                    <td>中(同步开销)</td>
                                    <td>高(无同步开销)</td>
                                </tr>
                                <tr>
                                    <td class="font-medium">内存使用</td>
                                    <td>常量池优化</td>
                                    <td>动态扩容</td>
                                    <td>动态扩容</td>
                                </tr>
                                <tr>
                                    <td class="font-medium">适用场景</td>
                                    <td>少量操作、常量、哈希键</td>
                                    <td>多线程字符串操作</td>
                                    <td>单线程高性能操作</td>
                                </tr>
                                <tr>
                                    <td class="font-medium">JDK版本</td>
                                    <td>1.0</td>
                                    <td>1.0</td>
                                    <td>1.5</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <h3 class="text-xl font-semibold mb-4 text-indigo-600">选择流程图</h3>
                        <div class="mermaid-container">
                            <div class="mermaid">
                                graph TD
                                    A[需要处理字符串] --> B{需要修改字符串?}
                                    B -->|否| C[使用String]
                                    B -->|是| D{多线程环境?}
                                    D -->|是| E[使用StringBuffer]
                                    D -->|否| F[使用StringBuilder]
                            </div>
                        </div>
                    </div>
                </div>
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <h3 class="text-xl font-semibold mb-4 text-indigo-600">最佳实践建议</h3>
                        <ul class="text-gray-700 space-y-4">
                            <li class="flex items-start">
                                <div class="flex-shrink-0">
                                    <div class="flex items-center justify-center h-8 w-8 rounded-full bg-indigo-100 text-indigo-600">
                                        <i class="fas fa-lightbulb"></i>
                                    </div>
                                </div>
                                <div class="ml-3">
                                    <p><strong>优先使用StringBuilder</strong>：在大多数情况下（单线程），这是性能最好的选择。</p>
                                </div>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0">
                                    <div class="flex items-center justify-center h-8 w-8 rounded-full bg-indigo-100 text-indigo-600">
                                        <i class="fas fa-users"></i>
                                    </div>
                                </div>
                                <div class="ml-3">
                                    <p><strong>共享变量用StringBuffer</strong>：当字符串缓冲区会被多个线程访问时，必须使用StringBuffer。</p>
                                </div>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0">
                                    <div class="flex items-center justify-center h-8 w-8 rounded-full bg-indigo-100 text-indigo-600">
                                        <i class="fas fa-lock"></i>
                                    </div>
                                </div>
                                <div class="ml-3">
                                    <p><strong>不变字符串用String</strong>：对于不会改变的字符串，使用String可以利用常量池优化。</p>
                                </div>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0">
                                    <div class="flex items-center justify-center h-8 w-8 rounded-full bg-indigo-100 text-indigo-600">
                                        <i class="fas fa-tachometer-alt"></i>
                                    </div>
                                </div>
                                <div class="ml-3">
                                    <p><strong>预估初始容量</strong>：对于StringBuilder/StringBuffer，预估大小并设置初始容量可以减少扩容操作。</p>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </section>

        <!-- Summary Section -->
        <section class="bg-white rounded-xl shadow-md overflow-hidden mb-16">
            <div class="p-8">
                <div class="text-center mb-8">
                    <h2 class="text-3xl font-bold text-gray-900">总结回顾</h2>
                    <p class="text-gray-600 mt-2 max-w-2xl mx-auto">理解这三种字符串处理类的差异是编写高效Java代码的基础</p>
                </div>
                <div class="grid md:grid-cols-3 gap-6">
                    <div class="border border-gray-200 rounded-lg p-6">
                        <h3 class="text-xl font-semibold mb-3 text-blue-600">String</h3>
                        <p class="text-gray-700 mb-4">不可变，线程安全，适合少量操作和常量使用</p>
                        <div class="text-sm text-gray-500 italic">
                            "当字符串不需要改变时使用String"
                        </div>
                    </div>
                    <div class="border border-gray-200 rounded-lg p-6">
                        <h3 class="text-xl font-semibold mb-3 text-purple-600">StringBuffer</h3>
                        <p class="text-gray-700 mb-4">可变，线程安全，适合多线程环境</p>
                        <div class="text-sm text-gray-500 italic">
                            "当多线程需要修改同一字符串时使用StringBuffer"
                        </div>
                    </div>
                    <div class="border border-gray-200 rounded-lg p-6">
                        <h3 class="text-xl font-semibold mb-3 text-green-600">StringBuilder</h3>
                        <p class="text-gray-700 mb-4">可变，非线程安全，性能最高</p>
                        <div class="text-sm text-gray-500 italic">
                            "单线程环境下字符串修改的首选"
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-8">
        <div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold">技术小馆</h3>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition duration-150 ease-in-out">
                        <i class="fas fa-link mr-2"></i> http://www.yuque.com/jtostring
                    </a>
                </div>
            </div>
            <div class="mt-8 pt-8 border-t border-gray-800 text-center text-gray-400 text-sm">
                <p>© 2023 技术小馆. 保留所有权利.</p>
            </div>
        </div>
    </footer>

    <script>
        // 初始化Mermaid图表
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            fontFamily: 'Noto Sans SC',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            },
            classDiagram: {
                useMaxWidth: true,
                htmlLabels: true
            }
        });
    </script>
</body>
</html>
```